﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model;

namespace PropertyAppraisal.SystemManage
{
    public partial class UpdateRole : System.Web.UI.Page
    {
        private static BLL.RolesBll rbll = new BLL.RolesBll();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        /// <summary>
        /// 反填角色信息
        /// </summary>
        /// <param name="pnum"></param>
        /// <returns></returns>
        [WebMethod]
        public static string BackData(int roleid)
        {
            var result = rbll.BackRoles(roleid);
            return JsonConvert.SerializeObject(result);
        }

        /// <summary>
        /// 修改角色信息
        /// </summary>
        /// <param name="roleid">角色编号</param>
        /// <param name="name">角色名称</param>
        /// <param name="beizhu">备注</param>
        /// <returns></returns>
        [WebMethod]
        public static int UpdateRoles(int roleid, string name, string beizhu)
        {
            SysRoles r = new SysRoles();
            r.roles_Id = roleid;
            r.roles_Name = name;
            r.roles_Remarks = beizhu;
            r.roles_CreateTime = DateTime.Now;
            r.roles_CreatePeople = "王慧君";
            var result = rbll.UpdateRole(r, roleid);
            if (result)
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }

    }
}